package com.tianji.learning.controller;


import com.tianji.api.dto.leanring.LearningLessonDTO;
import com.tianji.learning.domain.dto.LearningRecordFormDTO;
import com.tianji.learning.service.ILearningRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 学习记录表 前端控制器
 * </p>
 *
 * @author xie
 * @since 2024-11-10
 */
@RestController
@RequestMapping("/learning-records")
@RequiredArgsConstructor
public class LearningRecordController {



   private final ILearningRecordService learningRecordService;

    /**
     * 查询当前用户指定课程的学习进度
     * @param courseId 课程id
     * @return 课表信息、学习记录及进度信息
     */
    @GetMapping("/course/{courseId}")
    LearningLessonDTO queryLearningRecordByCourse(@PathVariable("courseId") Long courseId){
        return learningRecordService.queryLearningRecordByCourse(courseId);

    }

    /**
     * 提交学习记录
     * @param courseId 课程id
     * @return
     */
    @PostMapping
    public void submitLearningRecord(@RequestBody LearningRecordFormDTO formDTO){
         learningRecordService.submitLearningRecord(formDTO);
    }










}
